#pragma once
#include "qlib/all.h"
#include "components.h"
#include "models.h"
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include "../../layout/layout.hpp"

namespace qbe::editing::Drift {

void initOffsetFunc(DriftModel& param);

std::string offsetFunc(DriftModel& param, std::string& json_str);

std::vector<qlib::Vec2d> objectCoordinatePoints(std::vector<double> coordinate);

rapidjson::Value vector_array_double(std::vector<double> vaules, rapidjson::Document::AllocatorType& allocator);

rapidjson::Value vector_vector_array_double(std::vector<std::vector<double>> vaules, rapidjson::Document::AllocatorType& allocator);

std::vector<std::vector<double>> array_vectot_vector_double(rapidjson::Value& value);

//偏移线
void driftLineFunc(DriftModel& param, qlib::Path::s_ptr line_node, double x, double y);

void driftPolygonFunc(DriftModel& param, qlib::Polygon::s_ptr polygon_node, double x, double y);

void driftRectangle(DriftModel& param, qlib::Rectangle::s_ptr rectangle_node, double x, double y);

void driftCircle(DriftModel& param, qlib::Ellipse::s_ptr ellipse_node, double x, double y);

}